/**
 * Sep 17, 2013 3:38:46 PM
 * com.kratonsolution.belian.kernel.dm
 * Model.java
 */
package com.kratonsolution.belian.kernel.dm;

import java.io.Serializable;
import java.sql.Timestamp;

import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import javax.persistence.Version;

/**
 * @author Agung Dodi Perdana
 * @email agung.dodi.perdana@gmail.com
 * @Version Sinch 0.0.1
 */
@SuppressWarnings("serial")
@MappedSuperclass
public abstract class Model implements IAuditable,Serializable
{
    @Id
    protected String id;
    
    @Version
    protected Long version;
    
    @Column(name="created_by")
    protected String createdBy;
    
    @Column(name="last_updated_by")
    protected String lastUpdatedBy;
    
    @Column(name="created_time")
    protected Timestamp createdTime;
    
    @Column(name="last_updated_time")
    protected Timestamp lastUpdatedTime;
    
    public String getId()
    {
        return this.id;
    }

    public void setId(String id)
    {
        this.id = id;
    }

    public void setVersion(Long version)
    {
        this.version = version;
    }

    public Long getVersion()
    {
        return this.version;
    }

    public String getCreatedBy()
    {
        return createdBy;
    }

    public void setCreatedBy(String createdBy)
    {
        this.createdBy = createdBy;
    }

    public String getLastUpdatedBy()
    {
        return lastUpdatedBy;
    }

    public void setLastUpdatedBy(String lastUpdatedBy)
    {
        this.lastUpdatedBy = lastUpdatedBy;
    }

    public Timestamp getCreatedTime()
    {
        return createdTime;
    }

    public void setCreatedTime(Timestamp createdTime)
    {
        this.createdTime = createdTime;
    }

    public Timestamp getLastUpdatedTime()
    {
        return lastUpdatedTime;
    }

    public void setLastUpdatedTime(Timestamp lastUpdatedTime)
    {
        this.lastUpdatedTime = lastUpdatedTime;
    }
    
    /**
     * by default system will automaticly generating database primary key for each
     * model inserted into database,but if default key not sufficient,user should
     * override this method to provide custom primary key.
     * 
     * default will return null thats mean system will automaticly generate one for every
     * database insert attempt
     */
    public String getCustomPrimaryKey()
    {
        return null;
    }
}
